<?php
/**
 *TextLanguage Model
 *
 *@author S.Feil, T.Ziegler, M.El-Hindi <goatymail@googlemail.com>
 *27 May 2012
 *@copyright Copyright (c) 2012, S.Feil, T.Ziegler, M.El-Hindi
 *@package cms
 *
 */
/**
 * TextLanguage_Model
 * Loads the different contents in different languages
 *@package model
 */
class TextLanguage_Model extends Model{
        /**
     * Holds connection to database
     * @var object
     */
    protected $oDBInstance;
    /**
     * Model constructor
     * establishes connection to database
     */
    public function __construct(){
        $this->oDBInstance = Mysql_dbconnection::getInstance();

    }

/**
 * Loads the content in the language which was passed
 * @param string name 
 * @param integer language
 */
    public function getTextByName($sName, $iLanguage){
        $sName = $this->oDBInstance->getSQLValueString($sName,'string');
        $iLanguage = $this->oDBInstance->getSQLValueString($iLanguage,'int');
        $this->oDBInstance->query("SELECT content FROM bs_text_language WHERE name = $sName AND lid = '$iLanguage'");
        $aResult = $this->oDBInstance->fetch('array');
        if(isset($aResult[0]['content'])){
        return $aResult[0]['content'];
        }else{
             return "";
        }
    }

   
}
